
from redis import Redis,StrictRedis
redis = StrictRedis(host="127.0.0.1",port=6379,db=0)



if __name__ == '__main__':
    # redis.set("name","xiaoming")
    # redis.setex("sms:13312341234",30,"12345")
    # redis.setex("sms:13345674567",30,"23456")

    # redis.delete("name")
    # redis.hset("humen","name","xiaoming")
    # redis.hmset("humen",{"name":"xiaohong","sex":1})

    print(redis.get("nickname"))

    print(redis.hgetall("humen"))

    print(redis.lindex("brother",2))

    print(redis.lrange("brother",0,-1))
    humen = redis.hgetall("humen")
    print(humen)
    print(humen[b"name"])
    print(humen["name".encode()])
    print(redis.get("sms"))
    redis.expire("humen",300)
